//
// Created by weslywang on 2020/5/1.
//

#include "../common/common.h"

int maxProfit(vector<int> &prices) {
    int res = 0;
    int size = prices.size();
    if (size <= 1) {
        return 0;
    }
    for (int i = 0; i < size - 1; ++i) {
        if (prices[i] < prices[i + 1]) {
            res += (prices[i + 1] - prices[i]);
        }

    }
    return res;
}

int main() {
    Common common;
    vector<vector<int>> data = common.loadData();
    for (int i = 0; i <= data.size(); i++) {
        maxProfit(data[i]);
        cout << "**************" << endl;
    }
    return 0;
}